package com.ipay.mapper;

import com.ipay.bean.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;

/**
 * @author ：xiaopingzhang8@creditease.cn
 * @Description ：
 * @ClassName ：OrderMapper
 * @Company ：普信恒业科技发展（北京）有限公司
 * @date ：2018/4/9 11:11
 */
@Mapper
@CacheConfig(cacheNames = {"order"})
public interface OrderMapper {

    @Insert("insert into t_orderpay (tradeId,customerId,outAccount,inAccount,payAmount) values (#{tradeId},#{customerId},#{outAccount},#{inAccount},#{payAmount})")
    int insertOrder(Order order);

    @Cacheable(key = "#p0")
    @Select("select * from t_orderpay where tradeId = #{tradeId}")
    Order findOrder(@Param("tradeId") String orderId);
}
